# coding=utf-8
# 习题16：读写文件
# 命令python exercise_16.py exercise_15.txt
'''
Created on 2015年6月10日

@author: Doris
'''
#导入sys模块的argv
from sys import argv

scripte,filename = argv

print "We're going to erase %r." %filename
print "If you don't want that ,hit CTRL-C (^C)."
print "If you do want that, hit RETURN ."

raw_input("?")

print "Opening the file..."
target = open(filename,'w')

print "Truncating the file. Goodbye!"
target.truncate()

print "Now I going to ask you for three lines."

line1 = raw_input("line 1: ")
line2 = raw_input("line 2: ")
line3 = raw_input("line 3: ")

target.write(line1+'\n'+line2+'\n'+line3+'\n')

print "And finally ,we close it."

target.close()







